
function pageselectCallback(page_index, jq) {
    $.getJSON("move_list.php", {
        pag: page_index
    }).done(function(data) {
        $("#tbl > tbody").html("");
        $.each(data, function(key, val) {
            $("#tbl > tbody").append(
                    "<tr><td style=\"display:none\" class=\"id\">" + val.id +
                    "</td><td class=\"move_date\">" + val.move_date +
                    "</td><td class=\"product_id\" style=\"text-align:left\">" + val.product_id+
                    "</td><td class=\"type\">" + ((val.type == 1)?"Entrada":"Salida") +    
                    "</td><td class=\"quantity\">" + val.stock +
                    "</td><td class=\"quantity\">" + val.quantity +
                    "</td><td class=\"price\">" + val.price.replace("$", "S/.") +
                    "</td><td class=\"total\">" + val.total.replace("$", "S/.") +
                    
                    "</tr>");

        });
    });
}

function load( ) {
    $("#tbl > tbody").html("");
    $.getJSON("move_count.php", function(data) {
        $("#pa").pagination(data[0].count, {
            //num_edge_entries: 3,
            num_display_entries: 10,
            callback: pageselectCallback,
            items_per_page: 10
        });
    });
}

jQuery(document).ready(function($) {
    
    
    load();

    
});
